<!DOCTYPE html>
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
	<style type="text/css">
	body, html,#allmap {width: 100%;height: 100%;overflow: hidden;margin:0;font-family:"微软雅黑";}
    </style>
    <script src="https://mapopen.bj.bcebos.com/github/BMapGLLib/TrackAnimation/src/TrackAnimation.min.js"></script>
	<script type="text/javascript" src="https://api.map.baidu.com/api?type=webgl&v=1.0&ak=Oep0V9DtrFAmRECPKH5TixIzhXnxfv6v
    "></script>
    <title>视角动画</title>
</head>
<body>
	<div id="allmap"></div>
</body>
</html>
<script type="text/javascript">
    // GL版命名空间为BMapGL
    // 按住鼠标右键，修改倾斜角和角度
	var bmap = new BMapGL.Map("allmap");    // 创建Map实例
	bmap.centerAndZoom(new BMapGL.Point(116.806549, 38.570862), 17);  // 初始化地图,设置中心点坐标和地图级别
    bmap.enableScrollWheelZoom(true);     // 开启鼠标滚轮缩放
    var path = [{
    	'lng': 116.806549,
    	'lat': 38.570862
    }, {
    	'lng': 117.579555,
    	'lat': 39.131724
    }, {
    	'lng': 118.296975,
    	'lat': 39.698899
    }, {
    	'lng': 119.543392,
    	'lat': 39.98786
    }, {
    	'lng': 120.770029,
    	'lat': 40.748759
    }, {
    	'lng': 121.935125,
    	'lat': 41.239713
    }, {
    	'lng': 122.378935,
    	'lat': 40.780256
    }, {
    	'lng': 122.465122,
    	'lat': 40.686424
    }, {
    	'lng': 122.281104,
    	'lat': 40.413576
    }, {
    	'lng': 121.865337,
    	'lat': 39.712791
    }, {
    	'lng': 121.862224,
    	'lat': 39.344843
    },{
    	'lng': 121.711672,
    	'lat': 39.11006
    },{
    	'lng': 121.530216,
    	'lat': 38.991424
    }];
    var point = [];
    for (var i = 0; i < path.length; i++) {
        point.push(new BMapGL.Point(path[i].lng, path[i].lat));
    }
    var pl = new BMapGL.Polyline(point);
    setTimeout('start()', 0);
    function start () {
        trackAni = new BMapGLLib.TrackAnimation(bmap, pl, {
            overallView: true,
            tilt: 30,
            duration: 20000,
            delay: 300
        });
        trackAni.start();
    }
</script>
